<template>
  <view class="positionMgmt">
    <view class="header flex-row-align-center common-bg-white">
      <view class="flex">{{ department.name }}</view>
      <view class="delete"
        v-if="department.name == '人力部门'"
        @tap.stop="handleAccountMgmt"
      >
        账号管理
      </view>
      <!-- <p
        class="setting-dep"
        v-if="item.name == '人力部门'"
        @tap.stop="handleItem"
        :data-item="item"
        data-type="account"
      >
        账号管理
      </p> -->
    </view>
    <view class="box common-bg-white">
      <view>已添加岗位</view>
      <view class="list">
        <block v-for="(item, index) in addedJobs" :key="item.id">
          <view class="position-item">
            <image
              @tap="handleDelete"
              :data-index="index"
              :data-item="item"
              src="https://talentsupload.oss-cn-beijing.aliyuncs.com/miniprogram/common/sub.png"
            />
            <view class="single-line margin-lr-three">{{ item.name }}</view>
          </view>
        </block>
      </view>
    </view>

    <view class="box common-bg-white">
      <view class="title">未添加岗位</view>
      <view class="divider"></view>
      <block v-for="(item, index) in allJobs" :key="item.id">
        <view class="sub-title">{{ item.name }}</view>
        <view class="list" v-if="item.children.length">
          <block v-for="(child, idx) in item.children" :key="child.id">
            <view class="position-item">
              <image
                @tap="handleAdd"
                :data-parent-index="index"
                :data-child-item="child"
                :data-child-index="idx"
                src="https://talentsupload.oss-cn-beijing.aliyuncs.com/miniprogram/common/add.png"
              />
              <view class="single-line margin-lr-three">{{ child.name }}</view>
            </view>
          </block>
        </view>
        <view class="divider" v-if="index != allJobs.length - 1"></view>
      </block>
    </view>

    <view class="footer between-item-center-row">
      <view :class="['btn', 'next-active']" @click="handleSave"> 保存 </view>
    </view>
  </view>
</template>
<script src="./indexMod.js" />
<style src="./indexStyle.scss" lang="scss" scoped>
</style>